<template>
  <div class="root-view">
    <div class="search">
      <img src="@/assets/images/home/search.png" alt="" />
      <input
        type="text"
        v-model="searchValue"
        :placeholder="$t('首页.请输入搜索内容')"
      />
      <button class="btnsearch" @click="$emit('search', searchValue)">
        {{ $t("首页.搜索") }}
      </button>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    searchText: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      searchValue: "",
    };
  },
  mounted() {
    if (this.searchText) {
      this.searchValue = this.searchText;
    }
  },
};
</script>
<style lang="less" scoped>
.root-view {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-direction: row;

  .search {
    width: 50%;
    height: 60px;
    background: #fff;
    border: 1px solid #f1f1f1;
    box-shadow: 0px 0px 10px 0px rgba(227, 227, 227, 0.41);
    border-radius: 30px;
    margin: 30px 0px;
    overflow: hidden;
    display: flex;
    align-items: center;

    img {
      width: 25px;
      height: 25px;
      margin-left: 10px;
    }

    input {
      width: 82%;
      height: 100%;
      outline: none;
      border: 0;
      background-color: transparent;
      text-indent: 2em;
      font-size: 20px;
      font-weight: 400;
      color: #999999;
    }

    .btnsearch {
      width: 150px;
      height: 54px;
      background: #ff5757;
      border-radius: 30px;
      // font-size: 20px;
      font-weight: 400;
      color: #ffffff;
      text-align: center;
      line-height: 54px;
      border: 0;
      outline: 0;
    }
  }
}
</style>
